package cn.zyjblogs.server.role.po;

import cn.zyjblogs.starter.common.entity.constant.CommonConstant;
import com.alibaba.fastjson2.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author zhuyijun
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("role")
public class RolePo implements Serializable {
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private String id;
    @TableField("name")
    private String name;
    @TableField("status")
    private Integer status;
    @TableField("role_type")
    private Integer roleType;
    @TableField("deleted")
    private Integer deleted;

    @TableField("description")
    private String description;

    @TableField("create_user_id")
    private String createUserId;

    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JSONField(format = CommonConstant.DATETIME_PATTERN)
    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("edit_user_id")
    private String editUserId;

    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JSONField(format = CommonConstant.DATETIME_PATTERN)
    @TableField("edit_time")
    private LocalDateTime editTime;

    @TableField("tenant_id")
    private String tenantId;

}
